package model;

import java.sql.Date;
import java.util.Collection;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.CascadeType;
@Entity
@Table(name="login")
@SequenceGenerator(initialValue=1, sequenceName="seq_login", name="login") 
public class Login {
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="id_login")
	private long id;

	private String login;

	private String senha;

	private Date datadecriacao;
	
	@OneToMany(mappedBy="login", fetch = FetchType.LAZY)
	@Cascade(CascadeType.ALL)
	private Collection<Usuario> usuarios;
	
	public long getId() {
		return id;
	}
	public void setId(long id) {
		this.id = id;
	}
	public String getLogin() {
		return login;
	}
	public void setLogin(String login) {
		this.login = login;
	}
	public String getSenha() {
		return senha;
	}
	public void setSenha(String senha) {
		this.senha = senha;
	}
	public Date getDatadecriacao() {
		return datadecriacao;
	}
	public void setDatadecriacao(Date datadecriacao) {
		this.datadecriacao = datadecriacao;
	}
	public Collection<Usuario> getUsuarios() {
		return usuarios;
	}
	public void setUsuarios(Collection<Usuario> usuarios) {
		this.usuarios = usuarios;
	}
	
	

}
